<template>
    <view class="c-container">
        <view class="c-row">
            <view class="c-row-col" v-if="orderInfo.contract_no">
                <view class="col-title">合同编号</view>
                <view class="col-text">{{ orderInfo.contract_no }}</view>
            </view>
            <view class="c-row-col">
                <view class="col-title">订单类型</view>
                <view class="col-text">{{ orderInfo.news_type }}</view>
            </view>
        </view>
        <view class="c-row">
            <view class="c-row-col" v-if="orderInfo.company_id > 0">
                <view class="col-title">签约公司</view>
                <view class="col-text">{{ orderInfo.company }}</view>
            </view>
        </view>
        <view class="c-row">
            <view class="c-row-col" v-if="orderInfo.cooperation_mode">
                <view class="col-title">合作模式</view>
                <view class="col-text">{{ orderInfo.cooperation_mode }}</view>
            </view>
            <view class="c-row-col">
                <view class="col-title">销售</view>
                <view class="col-text">{{ orderInfo.username }}</view>
            </view>
        </view>
        <view class="c-row">
            <view class="c-row-col" v-if="orderInfo.hotel">
                <view class="col-title">举办酒店</view>
                <view class="col-text">{{ orderInfo.hotel }}</view>
            </view>
        </view>
        <view class="c-row" v-if="!['11', '12'].includes(orderOrigin.news_type)">
            <view class="c-row-col" v-if="orderInfo.hall && orderInfo.hall.length>0">
                <view class="col-title">宴会厅</view>
                <view class="col-text"><van-tag type="success" v-for="item in orderInfo.hall" :key="item.id">{{item.title}}</van-tag></view>
            </view>
        </view>
        <view class="c-row">
            <view class="c-row-col" v-if="orderInfo.banquet_type && orderInfo.banquet_type.length>0 && !['11', '12'].includes(orderOrigin.news_type)">
                <view class="col-title">婚宴类型</view>
                <view class="col-text">{{dictionary.convertBanquetTypeToStr(orderInfo.banquet_type)}}</view>
            </view>
            <view class="c-row-col" v-if="orderInfo.source_text">
                <view class="col-title">订单渠道</view>
                <view class="col-text">{{ orderInfo.source_text }}</view>
            </view>
        </view>
        <view class="c-row" v-if="!['11', '12'].includes(orderOrigin.news_type)">
            <view class="c-row-col" v-if="orderInfo.event_date">
                <view class="col-title">举办时间</view>
                <view class="col-text">{{ orderInfo.event_date }}</view>
            </view>
            <view class="c-row-col" v-if="orderInfo.sign_date">
                <view class="col-title">签单日期</view>
                <view class="col-text">{{ orderInfo.sign_date }}</view>
            </view>
        </view>
        <view class="c-row" v-if="!['11', '12'].includes(orderOrigin.news_type)">
            <view class="c-row-col" v-if="orderInfo.bride">
                <view class="col-title">新郎</view>
                <view class="col-text">{{ orderInfo.bride }}</view>
            </view>
            <view class="c-row-col" v-if="orderInfo.bridegroom">
                <view class="col-title">新娘</view>
                <view class="col-text">{{ orderInfo.bridegroom }}</view>
            </view>
        </view>
        <view class="c-row">
            <view class="c-row-col" v-if="orderInfo.score">
                <view class="col-title">积分</view>
                <view class="col-text">{{ orderInfo.score }}</view>
            </view>
            <view class="c-row-col" v-if="orderInfo.point">
                <view class="col-title">积点</view>
                <view class="col-text">{{orderInfo.point}}</view>
            </view>
        </view>
        <view class="c-row">
            <view class="c-row-col" v-if="orderInfo.remark">
                <view class="col-title">备注</view>
                <view class="col-text">{{ orderInfo.remark }}</view>
            </view>
        </view>

        <view class="c-row addons" v-if="orderInfo.addons && orderInfo.addons.length > 0">
            <view class="c-row-col">
                <!-- <view class="col-title">订单增项</view> -->
                <view class="col-remark">
                    <!-- 其他费用列表 -->
                    <view class="c-row-box" v-if="orderInfo.addons && orderInfo.addons.length > 0">
                        <!-- <view class="c-row-head">
							<view class="c-row-title">增项列表</view>
						</view> -->
                        <view class="panel-body">
                            <view class="other-list">
                                <view class="row" style="padding: 0 8px;">
                                    <view class="col">
                                        <view>类型</view>
                                    </view>
                                    <view class="col">
                                        <view>划分</view>
                                    </view>
                                    <view class="col">
                                        <view>数量</view>
                                    </view>
                                    <view class="col">
                                        <view>价格</view>
                                    </view>
                                    <view class="col">
                                        <view>小计</view>
                                    </view>
                                </view>
                                <view class="" v-for="(item, index) in orderInfo.addons" :key="index">
                                    <view class="row">
                                        <view class="col">
                                            <view>
                                                <template v-if="item.ritual_id > 0">
                                                    {{ dictionary.getPickerTitle('ritualList', item.ritual_id) }}
                                                </template>
                                                <template v-else-if="item.tag_id > 0">
                                                    {{ dictionary.getTitleByTag(item.type, item.tag_id, '') }}
                                                </template>
                                                <template v-else>
                                                    {{ item.other_value ? item.other_value :  item.title}}
                                                </template>
                                            </view>
                                        </view>
                                        <view class="col">
                                            <view>{{ item.cost_master == 2 ? '公司' : item.cost_master == 3 ? '酒店' : '无' }}</view>
                                        </view>
                                        <view class="col">
                                            <view>{{ item.amount }}</view>
                                        </view>
                                        <view class="col">
                                            <view>{{ item.price }}</view>
                                        </view>
                                        <view class="col">
                                            <view>{{ item.total }}</view>
                                        </view>
                                    </view>
                                    <view class="row border-bottom" v-if="item.remark">
                                        <view class="col p20">备注</view>
                                        <view class="col col-left">{{ item.remark }}</view>
                                    </view>
                                </view>
                            </view>
                        </view>
                    </view>
                </view>
            </view>
        </view>

        <view class="c-row" v-if="orderInfo.images && orderInfo.images.length">
            <view class="c-row-col">
                <view class="col-title">合同照片</view>
                <view class="col-text">
                    <image class="col-img" v-for="(img, imgIndex) in orderInfo.images" :key="imgIndex" :src="img" @click="previewImg({ list: orderInfo.images, index: imgIndex })"></image>
                </view>
            </view>
        </view>
    </view>
</template>

<script>
import dictionary from '@/utils/dictionary.js';
export default {
    name: 'cDetail',
    props: {
        orderInfo: {
            type: Object,
            default() {
                return {};
            }
        },
		orderOrigin:{
            type: Object,
            default() {
                return {};
            }
		}
    },
    data() {
        return {};
    },
    beforeMount() {
        this.dictionary = dictionary;
    },
    methods: {
        // 预览图片
        previewImg(data) {
            uni.previewImage({
                urls: data.list,
                current: data.index
            });
        }
    }
};
</script>

<style lang="less">
@import url("../common.less");
.c-container .van-tag {
    margin-right: 5px !important;
}
</style>
